﻿using System;

using KamLib.Web.MVC;


namespace KamLib.Web.Bootstrap
{


    public class Link : MvcElement
    {

        public string Url;

        public delegate Link Setter(MvcText text, string url = null);

        public Link Set(MvcText text, string url = null)
        {
            Text = text;
            Url = url;
            return this;
        }

        public static implicit operator Link(Action<Setter> setterAction)
        {
            var el = new Link();
            if (setterAction == null) return el;

            Setter setter = el.Set;
            setterAction(setter);
            return el;
        }

    }


    public static class LinkHelper
    {

        public static T Url<T>(this T me, string value)
            where T : Link
        {
            me.Url = value;
            return me;
        }

    }


}
